<?php

class ArticleMsg extends Mysql {
	public function __construct() {
		parent::__construct();
	}
	/**
	 * 根据文章articleId查询所有
	 * 2012-5-2 上午10:49:26
	 * Xewee.Zhiwei.Wang
	 */
	public function query($articleId) {
		$sql = "";
		if (empty($articleId) || ltrim($articleId) == '') {
			$sql = "select * from articleMsg where 1=0;";
		}
		else {
			$sql = "select * from articleMsg where articleId = '$articleId' order by time asc;";
		}
		$rows = $this->exec_query($sql);
		return $rows;
	}
	
	public function add($name, $content, $ip, $articleId) {
		$sql = "insert into articleMsg(name, content, time, ip, articleId) values ('$name', '$content', NOW(), '$ip', $articleId);";
		return $this->exec_update($sql);
	}
	
// 	public function delete($id) {
// 		$sql = "update article set deleted = '1' where id = $id;";
// 		return $this->exec_update($sql);
// 	}
	
// 	public function update($id, $title, $content, $adminId, $time, $typeId, $deleted) {
// 		$sql = "update article set 
// 				title = $title, 
// 				content = $content, 
// 				adminId = $adminId, 
// 				time = $time, 
// 				typeId = $typeId, 
// 				deleted = $deleted 
// 			where id = $id;";
// 		return $this->exec_update($sql);
// 	}
}

?>